package com.learn.schedule;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.LocalTime;

/**
 * Spring Task
 * 使用@Component注解标注一个类，在其中需要定时执行的方法上添加@Scheduled注解。
 *
 * @author: MI
 * @createDate: 2023/10/20 23:48
 * @updateUser: MI
 * @updateDate: 2023/10/20 23:48
 * @updateRemark: 修改内容
 * @version: v1.0
 */
@Component
public class ExampleSchedule {

    /**
     * 每隔1分钟执行1次
     *
     * @author: MI
     * @exception:
     * @date: 2023/10/21 9:01
     */
    @Scheduled(cron = "0/10 * * * * ?")
    public void job() {
        System.out.println("ExampleSchedule ===> job:" + LocalDate.now() + " " + LocalTime.now());
    }
}
